package demo3;

class Animlas {
    public String name;
    public int age;

    public Animlas(String name,int age) {//构造方法
        this.name = name;
        this.age = age;
    }

}
class Dog extends Animlas {
    public Dog(String name, int age) {
        super(name, age);
    }
    public void shor() {
        System.out.println(name + " 汪汪叫 !!!!!!");
    }

}

public class Test {
    public static void main(String[] args) {
        Animlas animlas = new Dog("啊黄",18);//直接赋值
        func(new Dog("啊黄",18));
        Animlas animlas1 = func2();
    }
    public static void func(Animlas animlas) {//传值向上转型

    }
    public static Animlas func2() {
        Animlas animlas = new Dog("啊黄",18);
        return animlas;//返回值调用
    }

}
